﻿<script type="text/javascript">
$(document).ready(function(){
$("#tableproduct").flexigrid(
{
url:'http://shoppingcartcnpm.orgfree.com/index.php/Longadmin/product/show',
dataType: 'json',
colModel : [
{display: 'PID', name : 'p_id', width : 40, sortable : true, align: 'center'},
{display: 'CatID', name : 'cat_id', width : 40, sortable : true, align: 'center'},
{display: 'SID', name : 's_id', width : 40, sortable : true, align: 'center'},
{display: 'Tên', name : 'p_ten', width : 120, sortable : true, align: 'center'},
{display: 'Giá', name : 'p_gia', width : 80, sortable : true, align: 'center'},
{display: 'Số Lượng', name : 'p_soLuong', width : 40, sortable : true, align: 'center'},
{display: 'Đã bán', name : 'p_daBan', width : 40, sortable : true, align: 'center'},
{display: 'Ảnh', name : 'p_linkImg', width : 50, sortable : true, align: 'center'},
],

buttons : [
{name: 'Add', bclass: 'add',onpress : test},
{name: 'Delete', bclass: 'delete',onpress : test},
{separator: true}
],
searchitems : [
{display: 'CatID', name : 'cat_id'},
{display: 'SID', name : 's_id', isdefault: true}
],
title:'Sản phẩm',
userpager: true,
userRp:true,
singleSelect: true,
showTableToggleBtn: true,
rp:10,
width:700,
height:200,

}
);

function test(com,grid)
{
if (com=='Delete')
{

}
else if (com=='Add')
{
alert('Add New Item');
$.nyroModalManual({
url: 'http://shoppingcartcnpm.orgfree.com/index.php/Longadmin/admin/addproduct',
width: 500, // default Width If null, will be calculate automatically
height: 500, // default Height If null, will be calculate automatically
minWidth: null, // Minimum width
minHeight: null, // Minimum height
endRemove: function() {window.location.reload()}
});
}
}


});
</script>
<table id = "tableproduct" style="display:none">
</table>

